﻿@{Lang lang = ViewBag.Lang;}
@model List<TGVR_Boot.DTO.TicketDTO>
@{
    if (Model != null && Model.Count > 0)
    {
        var temp = Model.Where(m => m.TypeWay.ToLower() == "in").OrderBy(m => m.Price).ToList();
        if (temp != null && temp.Count > 0)
        {
            int iCount = 0;
    <table cellpadding="0" cellspacing="0">
        <tbody>
            <tr>
                <td style="text-align: center">Hãng</td>
                <td style="text-align: center">Số hiệu</td>
                <td style="text-align: center">Thời gian</td>
                <td style="text-align: center">Giá vé</td>
            </tr>

            @foreach (var item in temp)
            {
                
                <tr onclick="selectValR(this);"  id="@("R" + iCount)" title="@item.FlightNo">
                    <td>
                        <img src="@item.Image" /></td>
                    <td>@item.FlightNo</td>
                    <td style="text-align: center">@item.DateStart.ToString("HH:mm") - @item.DateEnd.ToString("HH:mm")</td>
                    <td style="text-align: right">@item.Price.ToString("#,##0")</td>
                </tr>
                iCount++;
            }

        </tbody>
    </table>
        }

    }
    else
    {
    <h3>Không tìm thấy</h3>
    }
}
<script type="text/javascript">
    //$(function () {
    //    $("tr").click(function () {
    //        $(this).addClass("selected").siblings().removeClass("selected");
    //    });
    //});
    function selectValR(obj) {
        $("#" + obj.id).addClass("selected").siblings().removeClass("selected");
        var val = $("#" + obj.id).attr("title");
        $("#ReturnTicket").val(val);
    }
</script>
<style>
    tr.selected {
        background-color: #ABABAC !important;
        cursor: pointer;
    }
</style>

